\hypertarget{a00100}{}\section{E\+:/knet-\/git/knet/knet/stream\+\_\+api.h 文件参考}
\label{a00100}\index{E\+:/knet-\/git/knet/knet/stream\+\_\+api.\+h@{E\+:/knet-\/git/knet/knet/stream\+\_\+api.\+h}}
{\ttfamily \#include \char`\"{}config.\+h\char`\"{}}\\*
\subsection*{函数}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{a00120_gaf8953f6ed7542a6144dbc5461d2c8402_gaf8953f6ed7542a6144dbc5461d2c8402}{knet\+\_\+stream\+\_\+available} (\hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$stream)
\begin{DoxyCompactList}\small\item\em 取得数据流内可读字节数 \end{DoxyCompactList}\item 
int \hyperlink{a00120_gad1526d745b7bfbb53d0a97e47237bc67_gad1526d745b7bfbb53d0a97e47237bc67}{knet\+\_\+stream\+\_\+eat\+\_\+all} (\hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$stream)
\begin{DoxyCompactList}\small\item\em 清空数据流 \end{DoxyCompactList}\item 
int \hyperlink{a00120_ga61026724ef09e2ca4bf2a652372411e2_ga61026724ef09e2ca4bf2a652372411e2}{knet\+\_\+stream\+\_\+eat} (\hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$stream, int size)
\begin{DoxyCompactList}\small\item\em 删除指定长度数据 \end{DoxyCompactList}\item 
int \hyperlink{a00120_gac6fbd27fc2e9a756c3debfc11cd31904_gac6fbd27fc2e9a756c3debfc11cd31904}{knet\+\_\+stream\+\_\+pop} (\hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$stream, void $\ast$buffer, int size)
\begin{DoxyCompactList}\small\item\em 从数据流内读取数据并清除数据 \end{DoxyCompactList}\item 
int \hyperlink{a00120_gae342abfa7489dac8cd0676ae54763034_gae342abfa7489dac8cd0676ae54763034}{knet\+\_\+stream\+\_\+push} (\hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$stream, const void $\ast$buffer, int size)
\begin{DoxyCompactList}\small\item\em 向数据流内写数据 \end{DoxyCompactList}\item 
int \hyperlink{a00120_ga5385c5f448246089a80f0ca38de23e0d_ga5385c5f448246089a80f0ca38de23e0d}{knet\+\_\+stream\+\_\+push\+\_\+varg} (\hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$stream, const char $\ast$format,...)
\begin{DoxyCompactList}\small\item\em 向数据流写数据，可变参数字符串 \end{DoxyCompactList}\item 
int \hyperlink{a00120_ga6a338066a7df103ed2c7a46dc0a5b3c4_ga6a338066a7df103ed2c7a46dc0a5b3c4}{knet\+\_\+stream\+\_\+copy} (\hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$stream, void $\ast$buffer, int size)
\begin{DoxyCompactList}\small\item\em 从数据流内拷贝数据，但不清除数据流内数据 \end{DoxyCompactList}\item 
int \hyperlink{a00120_ga57debea3be18e64784e417edcc191673_ga57debea3be18e64784e417edcc191673}{knet\+\_\+stream\+\_\+push\+\_\+stream} (\hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$stream, \hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$target)
\begin{DoxyCompactList}\small\item\em 将stream内数据写入target, 并清除stream内数据 \end{DoxyCompactList}\item 
int \hyperlink{a00120_gae6aa07ada933f68fb4ed6e19ffd310b4_gae6aa07ada933f68fb4ed6e19ffd310b4}{knet\+\_\+stream\+\_\+copy\+\_\+stream} (\hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$stream, \hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$target)
\begin{DoxyCompactList}\small\item\em 将stream内数据写入target, 但不清除stream内数据 \end{DoxyCompactList}\item 
\hyperlink{a00056_a3b7e82599367eade261456f60ebe2cd9_a3b7e82599367eade261456f60ebe2cd9}{kchannel\+\_\+ref\+\_\+t} $\ast$ \hyperlink{a00120_ga6ec1754b28f693f5a5c047aef8cda3a8_ga6ec1754b28f693f5a5c047aef8cda3a8}{knet\+\_\+stream\+\_\+get\+\_\+channel\+\_\+ref} (\hyperlink{a00056_acc208c4c40c875eebbfef88f00fffacf_acc208c4c40c875eebbfef88f00fffacf}{kstream\+\_\+t} $\ast$stream)
\begin{DoxyCompactList}\small\item\em 获取流所属的管道引用 \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{函数说明}
\hypertarget{a00120_gaf8953f6ed7542a6144dbc5461d2c8402_gaf8953f6ed7542a6144dbc5461d2c8402}{}\index{stream\+\_\+api.\+h@{stream\+\_\+api.\+h}!knet\+\_\+stream\+\_\+available@{knet\+\_\+stream\+\_\+available}}
\index{knet\+\_\+stream\+\_\+available@{knet\+\_\+stream\+\_\+available}!stream\+\_\+api.\+h@{stream\+\_\+api.\+h}}
\subsubsection[{knet\+\_\+stream\+\_\+available}]{\setlength{\rightskip}{0pt plus 5cm}int knet\+\_\+stream\+\_\+available (
\begin{DoxyParamCaption}
\item[{{\bf kstream\+\_\+t} $\ast$}]{stream}
\end{DoxyParamCaption}
)}\label{a00120_gaf8953f6ed7542a6144dbc5461d2c8402_gaf8953f6ed7542a6144dbc5461d2c8402}


取得数据流内可读字节数 


\begin{DoxyParams}{参数}
{\em stream} & kstream\+\_\+t实例 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
可读字节数 
\end{DoxyReturn}
\hypertarget{a00120_ga6a338066a7df103ed2c7a46dc0a5b3c4_ga6a338066a7df103ed2c7a46dc0a5b3c4}{}\index{stream\+\_\+api.\+h@{stream\+\_\+api.\+h}!knet\+\_\+stream\+\_\+copy@{knet\+\_\+stream\+\_\+copy}}
\index{knet\+\_\+stream\+\_\+copy@{knet\+\_\+stream\+\_\+copy}!stream\+\_\+api.\+h@{stream\+\_\+api.\+h}}
\subsubsection[{knet\+\_\+stream\+\_\+copy}]{\setlength{\rightskip}{0pt plus 5cm}int knet\+\_\+stream\+\_\+copy (
\begin{DoxyParamCaption}
\item[{{\bf kstream\+\_\+t} $\ast$}]{stream, }
\item[{void $\ast$}]{buffer, }
\item[{int}]{size}
\end{DoxyParamCaption}
)}\label{a00120_ga6a338066a7df103ed2c7a46dc0a5b3c4_ga6a338066a7df103ed2c7a46dc0a5b3c4}


从数据流内拷贝数据，但不清除数据流内数据 


\begin{DoxyParams}{参数}
{\em stream} & kstream\+\_\+t实例 \\
\hline
{\em buffer} & 缓冲区 \\
\hline
{\em size} & 缓冲区大小 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00120_gae6aa07ada933f68fb4ed6e19ffd310b4_gae6aa07ada933f68fb4ed6e19ffd310b4}{}\index{stream\+\_\+api.\+h@{stream\+\_\+api.\+h}!knet\+\_\+stream\+\_\+copy\+\_\+stream@{knet\+\_\+stream\+\_\+copy\+\_\+stream}}
\index{knet\+\_\+stream\+\_\+copy\+\_\+stream@{knet\+\_\+stream\+\_\+copy\+\_\+stream}!stream\+\_\+api.\+h@{stream\+\_\+api.\+h}}
\subsubsection[{knet\+\_\+stream\+\_\+copy\+\_\+stream}]{\setlength{\rightskip}{0pt plus 5cm}int knet\+\_\+stream\+\_\+copy\+\_\+stream (
\begin{DoxyParamCaption}
\item[{{\bf kstream\+\_\+t} $\ast$}]{stream, }
\item[{{\bf kstream\+\_\+t} $\ast$}]{target}
\end{DoxyParamCaption}
)}\label{a00120_gae6aa07ada933f68fb4ed6e19ffd310b4_gae6aa07ada933f68fb4ed6e19ffd310b4}


将stream内数据写入target, 但不清除stream内数据 


\begin{DoxyParams}{参数}
{\em stream} & kstream\+\_\+t实例 \\
\hline
{\em target} & kstream\+\_\+t实例 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00120_ga61026724ef09e2ca4bf2a652372411e2_ga61026724ef09e2ca4bf2a652372411e2}{}\index{stream\+\_\+api.\+h@{stream\+\_\+api.\+h}!knet\+\_\+stream\+\_\+eat@{knet\+\_\+stream\+\_\+eat}}
\index{knet\+\_\+stream\+\_\+eat@{knet\+\_\+stream\+\_\+eat}!stream\+\_\+api.\+h@{stream\+\_\+api.\+h}}
\subsubsection[{knet\+\_\+stream\+\_\+eat}]{\setlength{\rightskip}{0pt plus 5cm}int knet\+\_\+stream\+\_\+eat (
\begin{DoxyParamCaption}
\item[{{\bf kstream\+\_\+t} $\ast$}]{stream, }
\item[{int}]{size}
\end{DoxyParamCaption}
)}\label{a00120_ga61026724ef09e2ca4bf2a652372411e2_ga61026724ef09e2ca4bf2a652372411e2}


删除指定长度数据 


\begin{DoxyParams}{参数}
{\em stream} & kstream\+\_\+t实例 \\
\hline
{\em size} & 需要删除的长度 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00120_gad1526d745b7bfbb53d0a97e47237bc67_gad1526d745b7bfbb53d0a97e47237bc67}{}\index{stream\+\_\+api.\+h@{stream\+\_\+api.\+h}!knet\+\_\+stream\+\_\+eat\+\_\+all@{knet\+\_\+stream\+\_\+eat\+\_\+all}}
\index{knet\+\_\+stream\+\_\+eat\+\_\+all@{knet\+\_\+stream\+\_\+eat\+\_\+all}!stream\+\_\+api.\+h@{stream\+\_\+api.\+h}}
\subsubsection[{knet\+\_\+stream\+\_\+eat\+\_\+all}]{\setlength{\rightskip}{0pt plus 5cm}int knet\+\_\+stream\+\_\+eat\+\_\+all (
\begin{DoxyParamCaption}
\item[{{\bf kstream\+\_\+t} $\ast$}]{stream}
\end{DoxyParamCaption}
)}\label{a00120_gad1526d745b7bfbb53d0a97e47237bc67_gad1526d745b7bfbb53d0a97e47237bc67}


清空数据流 


\begin{DoxyParams}{参数}
{\em stream} & kstream\+\_\+t实例 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00120_ga6ec1754b28f693f5a5c047aef8cda3a8_ga6ec1754b28f693f5a5c047aef8cda3a8}{}\index{stream\+\_\+api.\+h@{stream\+\_\+api.\+h}!knet\+\_\+stream\+\_\+get\+\_\+channel\+\_\+ref@{knet\+\_\+stream\+\_\+get\+\_\+channel\+\_\+ref}}
\index{knet\+\_\+stream\+\_\+get\+\_\+channel\+\_\+ref@{knet\+\_\+stream\+\_\+get\+\_\+channel\+\_\+ref}!stream\+\_\+api.\+h@{stream\+\_\+api.\+h}}
\subsubsection[{knet\+\_\+stream\+\_\+get\+\_\+channel\+\_\+ref}]{\setlength{\rightskip}{0pt plus 5cm}{\bf kchannel\+\_\+ref\+\_\+t}$\ast$ knet\+\_\+stream\+\_\+get\+\_\+channel\+\_\+ref (
\begin{DoxyParamCaption}
\item[{{\bf kstream\+\_\+t} $\ast$}]{stream}
\end{DoxyParamCaption}
)}\label{a00120_ga6ec1754b28f693f5a5c047aef8cda3a8_ga6ec1754b28f693f5a5c047aef8cda3a8}


获取流所属的管道引用 


\begin{DoxyParams}{参数}
{\em stream} & kstream\+\_\+t实例 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
kchannel\+\_\+ref\+\_\+t实例 
\end{DoxyReturn}
\hypertarget{a00120_gac6fbd27fc2e9a756c3debfc11cd31904_gac6fbd27fc2e9a756c3debfc11cd31904}{}\index{stream\+\_\+api.\+h@{stream\+\_\+api.\+h}!knet\+\_\+stream\+\_\+pop@{knet\+\_\+stream\+\_\+pop}}
\index{knet\+\_\+stream\+\_\+pop@{knet\+\_\+stream\+\_\+pop}!stream\+\_\+api.\+h@{stream\+\_\+api.\+h}}
\subsubsection[{knet\+\_\+stream\+\_\+pop}]{\setlength{\rightskip}{0pt plus 5cm}int knet\+\_\+stream\+\_\+pop (
\begin{DoxyParamCaption}
\item[{{\bf kstream\+\_\+t} $\ast$}]{stream, }
\item[{void $\ast$}]{buffer, }
\item[{int}]{size}
\end{DoxyParamCaption}
)}\label{a00120_gac6fbd27fc2e9a756c3debfc11cd31904_gac6fbd27fc2e9a756c3debfc11cd31904}


从数据流内读取数据并清除数据 


\begin{DoxyParams}{参数}
{\em stream} & kstream\+\_\+t实例 \\
\hline
{\em buffer} & 缓冲区 \\
\hline
{\em size} & 缓冲区大小 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00120_gae342abfa7489dac8cd0676ae54763034_gae342abfa7489dac8cd0676ae54763034}{}\index{stream\+\_\+api.\+h@{stream\+\_\+api.\+h}!knet\+\_\+stream\+\_\+push@{knet\+\_\+stream\+\_\+push}}
\index{knet\+\_\+stream\+\_\+push@{knet\+\_\+stream\+\_\+push}!stream\+\_\+api.\+h@{stream\+\_\+api.\+h}}
\subsubsection[{knet\+\_\+stream\+\_\+push}]{\setlength{\rightskip}{0pt plus 5cm}int knet\+\_\+stream\+\_\+push (
\begin{DoxyParamCaption}
\item[{{\bf kstream\+\_\+t} $\ast$}]{stream, }
\item[{const void $\ast$}]{buffer, }
\item[{int}]{size}
\end{DoxyParamCaption}
)}\label{a00120_gae342abfa7489dac8cd0676ae54763034_gae342abfa7489dac8cd0676ae54763034}


向数据流内写数据 


\begin{DoxyParams}{参数}
{\em stream} & kstream\+\_\+t实例 \\
\hline
{\em buffer} & 缓冲区 \\
\hline
{\em size} & 缓冲区大小 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00120_ga57debea3be18e64784e417edcc191673_ga57debea3be18e64784e417edcc191673}{}\index{stream\+\_\+api.\+h@{stream\+\_\+api.\+h}!knet\+\_\+stream\+\_\+push\+\_\+stream@{knet\+\_\+stream\+\_\+push\+\_\+stream}}
\index{knet\+\_\+stream\+\_\+push\+\_\+stream@{knet\+\_\+stream\+\_\+push\+\_\+stream}!stream\+\_\+api.\+h@{stream\+\_\+api.\+h}}
\subsubsection[{knet\+\_\+stream\+\_\+push\+\_\+stream}]{\setlength{\rightskip}{0pt plus 5cm}int knet\+\_\+stream\+\_\+push\+\_\+stream (
\begin{DoxyParamCaption}
\item[{{\bf kstream\+\_\+t} $\ast$}]{stream, }
\item[{{\bf kstream\+\_\+t} $\ast$}]{target}
\end{DoxyParamCaption}
)}\label{a00120_ga57debea3be18e64784e417edcc191673_ga57debea3be18e64784e417edcc191673}


将stream内数据写入target, 并清除stream内数据 


\begin{DoxyParams}{参数}
{\em stream} & kstream\+\_\+t实例 \\
\hline
{\em target} & kstream\+\_\+t实例 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00120_ga5385c5f448246089a80f0ca38de23e0d_ga5385c5f448246089a80f0ca38de23e0d}{}\index{stream\+\_\+api.\+h@{stream\+\_\+api.\+h}!knet\+\_\+stream\+\_\+push\+\_\+varg@{knet\+\_\+stream\+\_\+push\+\_\+varg}}
\index{knet\+\_\+stream\+\_\+push\+\_\+varg@{knet\+\_\+stream\+\_\+push\+\_\+varg}!stream\+\_\+api.\+h@{stream\+\_\+api.\+h}}
\subsubsection[{knet\+\_\+stream\+\_\+push\+\_\+varg}]{\setlength{\rightskip}{0pt plus 5cm}int knet\+\_\+stream\+\_\+push\+\_\+varg (
\begin{DoxyParamCaption}
\item[{{\bf kstream\+\_\+t} $\ast$}]{stream, }
\item[{const char $\ast$}]{format, }
\item[{}]{...}
\end{DoxyParamCaption}
)}\label{a00120_ga5385c5f448246089a80f0ca38de23e0d_ga5385c5f448246089a80f0ca38de23e0d}


向数据流写数据，可变参数字符串 

一次写入的长度不能超过1024 
\begin{DoxyParams}{参数}
{\em stream} & kstream\+\_\+t实例 \\
\hline
{\em format} & 字符串格式 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
